﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace PefStudio.StartUp
{
    public partial class SelectBootstrapperForm : Form
    {
        public SelectBootstrapperForm()
        {
            InitializeComponent();
        }

        public IEnumerable<Bootstrapper> Bootstrappers;
        public Bootstrapper SelectedBootstrapper;

        private void SelectBootstrapperForm_Load(object sender, EventArgs e)
        {
            foreach(var bootstrapper in Bootstrappers)
            {
                cobBootstrapper.Items.Add(bootstrapper.Description);
            }
            cobBootstrapper.SelectedIndex = 0;
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            foreach (var bootstrapper in Bootstrappers)
            {
                if (bootstrapper.Description == cobBootstrapper.SelectedItem.ToString())
                {
                    SelectedBootstrapper = bootstrapper;
                    break;
                }
            }
            DialogResult = DialogResult.OK;
        }
    }
}
